﻿using MediatR;
using T.Basic.API.Appliction.Command.LineCommand;
using T.Basic.Repository.BasicInterface;

namespace T.Basic.API.Appliction.CommandHandlers.LineHanders
{
    /// <summary>
    /// 删除线路（单删）
    /// </summary>
    public class LineDeleteCommandHandeler : IRequestHandler<LineDeleteCommand, int>
    {
       private readonly ILineRepository _lineRepository;
        public LineDeleteCommandHandeler(ILineRepository lineRepository)
        {
            _lineRepository = lineRepository;
        }

        public async Task<int> Handle(LineDeleteCommand request, CancellationToken cancellationToken)
        {
            var sss = await _lineRepository.GetModelsAsync(request.LineId);
            sss.IsDeleted = true;
          
            return await _lineRepository.UpdateAsync(sss);

        }
    }
}

